package com.hejia.alauda.entity;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public enum Traffic {
	
	QUALIFICATION ("QUALIFICATION","参与活动资格条件！","参与4月流量包活动，您必须在活动期间购买10000元的产品才能参与该活动！","10000"),
	
	START_DATE ("START_DATE","活动开始时间","4月微信流量活动正式开始时间","2015-04-15"),
	
	END_DATE ("END_DATE","活动结束时间","4月微信流量活动结束时间","2015-04-22"),
	
	DEV_START_DATE ("DEV_START_DATE","活动测试开始时间","4月微信流量活动测试开始时间","2015-04-01"),
	
	THANKS ("THANK","谢谢参与！","今日流量已送完，明天再来",null),
	
	WINNER ("WINNER","谢谢参与！","感谢您的参与，您已经获得过一次流量包！",null),
	
	TRAFFIC ("TRAFFIC","20元流量包！","恭喜您获得20元流量包！",null);
	
	private String code;

	private String name;

	private String description;

	private String condition;
	
	private Traffic(String code, String name, String description, String condition) {
		this.code = code;
		this.name = name;
		this.description = description;
		this.condition = condition;
	}
	
	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	public String getDescription() {
		return description;
	}

	public String getCondition() {
		return condition;
	}

	public static Date getDate(Traffic tra) {
		SimpleDateFormat mat = new SimpleDateFormat("yyyy-MM-dd");
		Date date = null;
		try {
			date = mat.parse(tra.getCondition());
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return date;
	}

}
